package com.ruoyi.contact.service.impl;

import java.util.List;
import com.ruoyi.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.contact.mapper.ContactRecordMapper;
import com.ruoyi.contact.domain.ContactRecord;
import com.ruoyi.contact.service.IContactRecordService;
import com.ruoyi.common.core.text.Convert;

/**
 * 联系记录Service业务层处理
 * 
 * @author ruoyi
 * @date 2025-05-30
 */
@Service
public class ContactRecordServiceImpl implements IContactRecordService 
{
    @Autowired
    private ContactRecordMapper contactRecordMapper;

    /**
     * 查询联系记录
     * 
     * @param recordId 联系记录主键
     * @return 联系记录
     */
    @Override
    public ContactRecord selectContactRecordByRecordId(Long recordId)
    {
        return contactRecordMapper.selectContactRecordByRecordId(recordId);
    }

    /**
     * 查询联系记录列表
     * 
     * @param contactRecord 联系记录
     * @return 联系记录
     */
    @Override
    public List<ContactRecord> selectContactRecordList(ContactRecord contactRecord)
    {
        return contactRecordMapper.selectContactRecordList(contactRecord);
    }

    /**
     * 新增联系记录
     * 
     * @param contactRecord 联系记录
     * @return 结果
     */
    @Override
    public int insertContactRecord(ContactRecord contactRecord)
    {
        contactRecord.setCreateTime(DateUtils.getNowDate());
        return contactRecordMapper.insertContactRecord(contactRecord);
    }

    /**
     * 修改联系记录
     * 
     * @param contactRecord 联系记录
     * @return 结果
     */
    @Override
    public int updateContactRecord(ContactRecord contactRecord)
    {
        return contactRecordMapper.updateContactRecord(contactRecord);
    }

    /**
     * 批量删除联系记录
     * 
     * @param recordIds 需要删除的联系记录主键
     * @return 结果
     */
    @Override
    public int deleteContactRecordByRecordIds(String recordIds)
    {
        return contactRecordMapper.deleteContactRecordByRecordIds(Convert.toStrArray(recordIds));
    }

    /**
     * 删除联系记录信息
     * 
     * @param recordId 联系记录主键
     * @return 结果
     */
    @Override
    public int deleteContactRecordByRecordId(Long recordId)
    {
        return contactRecordMapper.deleteContactRecordByRecordId(recordId);
    }
}
